#pragma once

#include "../DefinesCore.hpp"
#include <vector>

CYBERTRON_BEGIN

class IdAllocator
{
public:
	CybertronCoreAPI IdAllocator();
	CybertronCoreAPI virtual ~IdAllocator();

	CybertronCoreAPI void clear();
	CybertronCoreAPI void reset(int minimalId, int maximalId);

	CybertronCoreAPI int allocateId();
	CybertronCoreAPI void releaseId(int id);

private:
	void zeroMembers();

private:
	int mMinimalId;
	int mMaximalId;
	std::vector<int> mFreeIds;
	std::vector<bool> mIsFreeFlags;
	int mCurrentMaximalId;
};

CYBERTRON_END
